#### 9/19/2015

##################################################################################
#### README: Eggers & Spirling "The Shadow Cabinet in Westminster Systems:  ######
#### Modeling Opposition Agenda Setting in the House of Commons, 1832--1915" #####
##################################################################################

This is a README that describes the replication materials for Eggers and Spirling "The Shadow Cabinet in Westminster Systems", to appear in /British Political Science Review/. There is a section on Data, Code/Files and R packages.


#################
##### Data ######
#################
There are several data sets (all derived from the same Eggers and Spirling data set from their Hansard project, and as described in their 2014 piece in Legislative Studies Quarterly).  These data are needed to replicate the results in the paper.  They are as follows:

- summary_speech.rdata
-- contains summary.data which has each MP in each session and the number of words spoken by that MP

- session_dates_all.csv
-- just gives exact session dates for parliaments (and source of that info)

- <members_over_time> folder
-- contains member_profile.csv which simply matches member id numbers to actual people (look up table)
-- contains member_bursts files for every session: records how bursty each member was in each session (and also includes name of text file/speech by MP which started biggest MP burst, but that info is not used in the paper)

- <terms_over_time> folder
-- contains burstiness of each term for each session (sorted). Helpful for validation.

- paneldata.rdata
-- contains panel.data which is a panel of Liberals and Conservatives (only) and the burstiness of their speeches in the various parliamentary sessions.  Specifically, it includes:
-- member id (member_id)
-- the session id (session)
-- name of the member (name)
-- the party of the member (party)
-- whether the MP was in cabinet (cabinet)
-- whether the member had a non-cabinet office (non_cabinet),
-- the 'actual burstiness' of the member, as described in the paper (burstiness.actual)
-- the 'burstiness' of the member which is the burstiness.actual + 100 whenever burstiness.actual is zero
-- the log of the burstiness (lb)
-- the number of speeches given by the MP (speeches)

- paneldata_all.rdata
-- contains panel.data which is as above, except that it includes all parties

- tdm_1884
-- contains term document matrix for the 1884 session of parliament
--> used to look at word "boundary" in burstiness terms

- speaker_data
-- dates of Speaker (the presiding office in the Commons) service (plus names and codes for look up)

- pooled.rdata
-- contains the various regressors (in panel structure) used for the 'switching power' regressions

######################
##### Files/Code #####
######################
Our paper used the R statistical language and environment for its analysis.

There are 9 replication files, which are R scripts that reproduce the figures and tables in the paper proper (contact the authors if you are interested in more details from the appendix).

The files (in <code>), and what they do, are as follows:
-  Replication_Code_1.R --- makes Fig 1: number of speeches by Gov and Oppn MPs over time
-  Replication_Code_2.R --- makes Fig 2: makes Fig 2; words per speech over time; number of speeches per MP over time
-  Replication_Code_3.R --- makes Fig 3:  'wedding cake' of term "boundary"
-  Replication_Code_4.R --- makes Fig 4: profile of bursty terms over time, and allows user to make Table 1 (very bursty terms in specific periods)
-  Replication_Code_5.R --- makes Fig 5: bursty profile of some MPs over time
-  Replication_Code_6.R --- makes Fig 6: burstiness of Speakers vs their number of speeches (in terms of rank in Commons)
-  Replication_Code_7.R --- makes Fig 7: ratio of burstiness over time, Cabinet vs oppn vs backbenchers
-  Replication_Code_8.R --- makes Fig 8: triple plot --  top one is "boxplot and outliers"; middle is same boxplots, but on STANDARDIZED data; bottom is declining number of outliers over time. Code also spits the number of MPs above the 90th percentile in each sess.
-  Replication_Code_9.R --- makes Table 2: 'main' regression table/results in paper


######################
##### R packages #####
######################

Access to the following R packages is required (current versions as of Sept 19, 2015):
- bursts
- tm
- strucchange
- scales
- apsrtable
- sandwich
- lmtest
